home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / info / gcc.info-7 < prev    next >
Encoding:
GNU Info File  |  2001-07-15  |  42.1 KB  |  944 lines

  1. This is Info file gcc.info, produced by Makeinfo version 1.68 from the
  2. input file ./gcc.texi.
  3.  
  4. INFO-DIR-SECTION Programming
  5. START-INFO-DIR-ENTRY
  6. * gcc: (gcc).                  The GNU Compiler Collection.
  7. END-INFO-DIR-ENTRY
  8.    This file documents the use and the internals of the GNU compiler.
  9.  
  10.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  11. Boston, MA 02111-1307 USA
  12.  
  13.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
  14. 1999, 2000 Free Software Foundation, Inc.
  15.  
  16.    Permission is granted to make and distribute verbatim copies of this
  17. manual provided the copyright notice and this permission notice are
  18. preserved on all copies.
  19.  
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the sections entitled "GNU General Public License" and "Funding
  23. for Free Software" are included exactly as in the original, and
  24. provided that the entire resulting derived work is distributed under
  25. the terms of a permission notice identical to this one.
  26.  
  27.    Permission is granted to copy and distribute translations of this
  28. manual into another language, under the above conditions for modified
  29. versions, except that the sections entitled "GNU General Public
  30. License" and "Funding for Free Software", and this permission notice,
  31. may be included in translations approved by the Free Software Foundation
  32. instead of in the original English.
  33.  
  34. 
  35. File: gcc.info,  Node: Environment Variables,  Next: Running Protoize,  Prev: Code Gen Options,  Up: Invoking GCC
  36.  
  37. Environment Variables Affecting GCC
  38. ===================================
  39.  
  40.    This section describes several environment variables that affect how
  41. GCC operates.  Some of them work by specifying directories or prefixes
  42. to use when searching for various kinds of files. Some are used to
  43. specify other aspects of the compilation environment.
  44.  
  45.    Note that you can also specify places to search using options such as
  46. `-B', `-I' and `-L' (*note Directory Options::.).  These take
  47. precedence over places specified using environment variables, which in
  48. turn take precedence over those specified by the configuration of GCC.
  49. *Note Driver::.
  50.  
  51. `LANG'
  52. `LC_CTYPE'
  53. `LC_MESSAGES'
  54. `LC_ALL'
  55.      These environment variables control the way that GCC uses
  56.      localization information that allow GCC to work with different
  57.      national conventions.  GCC inspects the locale categories
  58.      `LC_CTYPE' and `LC_MESSAGES' if it has been configured to do so.
  59.      These locale categories can be set to any value supported by your
  60.      installation.  A typical value is `en_UK' for English in the United
  61.      Kingdom.
  62.  
  63.      The `LC_CTYPE' environment variable specifies character
  64.      classification.  GCC uses it to determine the character boundaries
  65.      in a string; this is needed for some multibyte encodings that
  66.      contain quote and escape characters that would otherwise be
  67.      interpreted as a string end or escape.
  68.  
  69.      The `LC_MESSAGES' environment variable specifies the language to
  70.      use in diagnostic messages.
  71.  
  72.      If the `LC_ALL' environment variable is set, it overrides the value
  73.      of `LC_CTYPE' and `LC_MESSAGES'; otherwise, `LC_CTYPE' and
  74.      `LC_MESSAGES' default to the value of the `LANG' environment
  75.      variable.  If none of these variables are set, GCC defaults to
  76.      traditional C English behavior.
  77.  
  78. `TMPDIR'
  79.      If `TMPDIR' is set, it specifies the directory to use for temporary
  80.      files.  GCC uses temporary files to hold the output of one stage of
  81.      compilation which is to be used as input to the next stage: for
  82.      example, the output of the preprocessor, which is the input to the
  83.      compiler proper.
  84.  
  85. `GCC_EXEC_PREFIX'
  86.      If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the
  87.      names of the subprograms executed by the compiler.  No slash is
  88.      added when this prefix is combined with the name of a subprogram,
  89.      but you can specify a prefix that ends with a slash if you wish.
  90.  
  91.      If GCC cannot find the subprogram using the specified prefix, it
  92.      tries looking in the usual places for the subprogram.
  93.  
  94.      The default value of `GCC_EXEC_PREFIX' is `PREFIX/lib/gcc-lib/'
  95.      where PREFIX is the value of `prefix' when you ran the `configure'
  96.      script.
  97.  
  98.      Other prefixes specified with `-B' take precedence over this
  99.      prefix.
  100.  
  101.      This prefix is also used for finding files such as `crt0.o' that
  102.      are used for linking.
  103.  
  104.      In addition, the prefix is used in an unusual way in finding the
  105.      directories to search for header files.  For each of the standard
  106.      directories whose name normally begins with
  107.      `/usr/local/lib/gcc-lib' (more precisely, with the value of
  108.      `GCC_INCLUDE_DIR'), GCC tries replacing that beginning with the
  109.      specified prefix to produce an alternate directory name.  Thus,
  110.      with `-Bfoo/', GCC will search `foo/bar' where it would normally
  111.      search `/usr/local/lib/bar'.  These alternate directories are
  112.      searched first; the standard directories come next.
  113.  
  114. `COMPILER_PATH'
  115.      The value of `COMPILER_PATH' is a colon-separated list of
  116.      directories, much like `PATH'.  GCC tries the directories thus
  117.      specified when searching for subprograms, if it can't find the
  118.      subprograms using `GCC_EXEC_PREFIX'.
  119.  
  120. `LIBRARY_PATH'
  121.      The value of `LIBRARY_PATH' is a colon-separated list of
  122.      directories, much like `PATH'.  When configured as a native
  123.      compiler, GCC tries the directories thus specified when searching
  124.      for special linker files, if it can't find them using
  125.      `GCC_EXEC_PREFIX'.  Linking using GCC also uses these directories
  126.      when searching for ordinary libraries for the `-l' option (but
  127.      directories specified with `-L' come first).
  128.  
  129. `C_INCLUDE_PATH'
  130. `CPLUS_INCLUDE_PATH'
  131. `OBJC_INCLUDE_PATH'
  132.      These environment variables pertain to particular languages.  Each
  133.      variable's value is a colon-separated list of directories, much
  134.      like `PATH'.  When GCC searches for header files, it tries the
  135.      directories listed in the variable for the language you are using,
  136.      after the directories specified with `-I' but before the standard
  137.      header file directories.
  138.  
  139. `DEPENDENCIES_OUTPUT'
  140.      If this variable is set, its value specifies how to output
  141.      dependencies for Make based on the header files processed by the
  142.      compiler.  This output looks much like the output from the `-M'
  143.      option (*note Preprocessor Options::.), but it goes to a separate
  144.      file, and is in addition to the usual results of compilation.
  145.  
  146.      The value of `DEPENDENCIES_OUTPUT' can be just a file name, in
  147.      which case the Make rules are written to that file, guessing the
  148.      target name from the source file name.  Or the value can have the
  149.      form `FILE TARGET', in which case the rules are written to file
  150.      FILE using TARGET as the target name.
  151.  
  152. `LANG'
  153.      This variable is used to pass locale information to the compiler.
  154.      One way in which this information is used is to determine the
  155.      character set to be used when character literals, string literals
  156.      and comments are parsed in C and C++.  When the compiler is
  157.      configured to allow multibyte characters, the following values for
  158.      `LANG' are recognized:
  159.  
  160.     `C-JIS'
  161.           Recognize JIS characters.
  162.  
  163.     `C-SJIS'
  164.           Recognize SJIS characters.
  165.  
  166.     `C-EUCJP'
  167.           Recognize EUCJP characters.
  168.  
  169.      If `LANG' is not defined, or if it has some other value, then the
  170.      compiler will use mblen and mbtowc as defined by the default
  171.      locale to recognize and translate multibyte characters.
  172.  
  173. 
  174. File: gcc.info,  Node: Running Protoize,  Prev: Environment Variables,  Up: Invoking GCC
  175.  
  176. Running Protoize
  177. ================
  178.  
  179.    The program `protoize' is an optional part of GNU C.  You can use it
  180. to add prototypes to a program, thus converting the program to ANSI C
  181. in one respect.  The companion program `unprotoize' does the reverse:
  182. it removes argument types from any prototypes that are found.
  183.  
  184.    When you run these programs, you must specify a set of source files
  185. as command line arguments.  The conversion programs start out by
  186. compiling these files to see what functions they define.  The
  187. information gathered about a file FOO is saved in a file named `FOO.X'.
  188.  
  189.    After scanning comes actual conversion.  The specified files are all
  190. eligible to be converted; any files they include (whether sources or
  191. just headers) are eligible as well.
  192.  
  193.    But not all the eligible files are converted.  By default,
  194. `protoize' and `unprotoize' convert only source and header files in the
  195. current directory.  You can specify additional directories whose files
  196. should be converted with the `-d DIRECTORY' option.  You can also
  197. specify particular files to exclude with the `-x FILE' option.  A file
  198. is converted if it is eligible, its directory name matches one of the
  199. specified directory names, and its name within the directory has not
  200. been excluded.
  201.  
  202.    Basic conversion with `protoize' consists of rewriting most function
  203. definitions and function declarations to specify the types of the
  204. arguments.  The only ones not rewritten are those for varargs functions.
  205.  
  206.    `protoize' optionally inserts prototype declarations at the
  207. beginning of the source file, to make them available for any calls that
  208. precede the function's definition.  Or it can insert prototype
  209. declarations with block scope in the blocks where undeclared functions
  210. are called.
  211.  
  212.    Basic conversion with `unprotoize' consists of rewriting most
  213. function declarations to remove any argument types, and rewriting
  214. function definitions to the old-style pre-ANSI form.
  215.  
  216.    Both conversion programs print a warning for any function
  217. declaration or definition that they can't convert.  You can suppress
  218. these warnings with `-q'.
  219.  
  220.    The output from `protoize' or `unprotoize' replaces the original
  221. source file.  The original file is renamed to a name ending with
  222. `.save'.  If the `.save' file already exists, then the source file is
  223. simply discarded.
  224.  
  225.    `protoize' and `unprotoize' both depend on GCC itself to scan the
  226. program and collect information about the functions it uses.  So
  227. neither of these programs will work until GCC is installed.
  228.  
  229.    Here is a table of the options you can use with `protoize' and
  230. `unprotoize'.  Each option works with both programs unless otherwise
  231. stated.
  232.  
  233. `-B DIRECTORY'
  234.      Look for the file `SYSCALLS.c.X' in DIRECTORY, instead of the
  235.      usual directory (normally `/usr/local/lib').  This file contains
  236.      prototype information about standard system functions.  This option
  237.      applies only to `protoize'.
  238.  
  239. `-c COMPILATION-OPTIONS'
  240.      Use  COMPILATION-OPTIONS as the options when running `gcc' to
  241.      produce the `.X' files.  The special option `-aux-info' is always
  242.      passed in addition, to tell `gcc' to write a `.X' file.
  243.  
  244.      Note that the compilation options must be given as a single
  245.      argument to `protoize' or `unprotoize'.  If you want to specify
  246.      several `gcc' options, you must quote the entire set of
  247.      compilation options to make them a single word in the shell.
  248.  
  249.      There are certain `gcc' arguments that you cannot use, because they
  250.      would produce the wrong kind of output.  These include `-g', `-O',
  251.      `-c', `-S', and `-o' If you include these in the
  252.      COMPILATION-OPTIONS, they are ignored.
  253.  
  254. `-C'
  255.      Rename files to end in `.C' instead of `.c'.  This is convenient
  256.      if you are converting a C program to C++.  This option applies
  257.      only to `protoize'.
  258.  
  259. `-g'
  260.      Add explicit global declarations.  This means inserting explicit
  261.      declarations at the beginning of each source file for each function
  262.      that is called in the file and was not declared.  These
  263.      declarations precede the first function definition that contains a
  264.      call to an undeclared function.  This option applies only to
  265.      `protoize'.
  266.  
  267. `-i STRING'
  268.      Indent old-style parameter declarations with the string STRING.
  269.      This option applies only to `protoize'.
  270.  
  271.      `unprotoize' converts prototyped function definitions to old-style
  272.      function definitions, where the arguments are declared between the
  273.      argument list and the initial `{'.  By default, `unprotoize' uses
  274.      five spaces as the indentation.  If you want to indent with just
  275.      one space instead, use `-i " "'.
  276.  
  277. `-k'
  278.      Keep the `.X' files.  Normally, they are deleted after conversion
  279.      is finished.
  280.  
  281. `-l'
  282.      Add explicit local declarations.  `protoize' with `-l' inserts a
  283.      prototype declaration for each function in each block which calls
  284.      the function without any declaration.  This option applies only to
  285.      `protoize'.
  286.  
  287. `-n'
  288.      Make no real changes.  This mode just prints information about the
  289.      conversions that would have been done without `-n'.
  290.  
  291. `-N'
  292.      Make no `.save' files.  The original files are simply deleted.
  293.      Use this option with caution.
  294.  
  295. `-p PROGRAM'
  296.      Use the program PROGRAM as the compiler.  Normally, the name `gcc'
  297.      is used.
  298.  
  299. `-q'
  300.      Work quietly.  Most warnings are suppressed.
  301.  
  302. `-v'
  303.      Print the version number, just like `-v' for `gcc'.
  304.  
  305.    If you need special compiler options to compile one of your program's
  306. source files, then you should generate that file's `.X' file specially,
  307. by running `gcc' on that source file with the appropriate options and
  308. the option `-aux-info'.  Then run `protoize' on the entire set of
  309. files.  `protoize' will use the existing `.X' file because it is newer
  310. than the source file.  For example:
  311.  
  312.      gcc -Dfoo=bar file1.c -aux-info
  313.      protoize *.c
  314.  
  315. You need to include the special files along with the rest in the
  316. `protoize' command, even though their `.X' files already exist, because
  317. otherwise they won't get converted.
  318.  
  319.    *Note Protoize Caveats::, for more information on how to use
  320. `protoize' successfully.
  321.  
  322.    Note most of this information is out of date and superceded by the
  323. EGCS install procedures.  It is provided for historical reference only.
  324.  
  325. 
  326. File: gcc.info,  Node: Installation,  Next: C Extensions,  Prev: Invoking GCC,  Up: Top
  327.  
  328. Installing GNU CC
  329. *****************
  330.  
  331. * Menu:
  332.  
  333. * Configuration Files::  Files created by running `configure'.
  334. * Configurations::    Configurations Supported by GNU CC.
  335. * Other Dir::     Compiling in a separate directory (not where the source is).
  336. * Cross-Compiler::   Building and installing a cross-compiler.
  337. * Sun Install::   See below for installation on the Sun.
  338. * VMS Install::   See below for installation on VMS.
  339. * Collect2::      How `collect2' works; how it finds `ld'.
  340. * Header Dirs::   Understanding the standard header file directories.
  341.  
  342.    Here is the procedure for installing GNU CC on a GNU or Unix system.
  343. See *Note VMS Install::., for VMS systems.  In this section we assume
  344. you compile in the same directory that contains the source files; see
  345. *Note Other Dir::., to find out how to compile in a separate directory
  346. on Unix systems.
  347.  
  348.    You cannot install GNU C by itself on MSDOS; it will not compile
  349. under any MSDOS compiler except itself.  You need to get the complete
  350. compilation package DJGPP, which includes binaries as well as sources,
  351. and includes all the necessary compilation tools and libraries.
  352.  
  353.   1. If you have built GNU CC previously in the same directory for a
  354.      different target machine, do `make distclean' to delete all files
  355.      that might be invalid.  One of the files this deletes is
  356.      `Makefile'; if `make distclean' complains that `Makefile' does not
  357.      exist, it probably means that the directory is already suitably
  358.      clean.
  359.  
  360.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  361.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  362.      libraries which have bugs.
  363.  
  364.   3. Make sure the Bison parser generator is installed.  (This is
  365.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  366.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  367.      change the `.y' files.)
  368.  
  369.      Bison versions older than Sept 8, 1988 will produce incorrect
  370.      output for `c-parse.c'.
  371.  
  372.   4. If you have chosen a configuration for GNU CC which requires other
  373.      GNU tools (such as GAS or the GNU linker) instead of the standard
  374.      system tools, install the required tools in the build directory
  375.      under the names `as', `ld' or whatever is appropriate.  This will
  376.      enable the compiler to find the proper tools for compilation of
  377.      the program `enquire'.
  378.  
  379.      Alternatively, you can do subsequent compilation using a value of
  380.      the `PATH' environment variable such that the necessary GNU tools
  381.      come before the standard system tools.
  382.  
  383.   5. Specify the host, build and target machine configurations.  You do
  384.      this when you run the `configure' script.
  385.  
  386.      The "build" machine is the system which you are using, the "host"
  387.      machine is the system where you want to run the resulting compiler
  388.      (normally the build machine), and the "target" machine is the
  389.      system for which you want the compiler to generate code.
  390.  
  391.      If you are building a compiler to produce code for the machine it
  392.      runs on (a native compiler), you normally do not need to specify
  393.      any operands to `configure'; it will try to guess the type of
  394.      machine you are on and use that as the build, host and target
  395.      machines.  So you don't need to specify a configuration when
  396.      building a native compiler unless `configure' cannot figure out
  397.      what your configuration is or guesses wrong.
  398.  
  399.      In those cases, specify the build machine's "configuration name"
  400.      with the `--host' option; the host and target will default to be
  401.      the same as the host machine.  (If you are building a
  402.      cross-compiler, see *Note Cross-Compiler::..)
  403.  
  404.      Here is an example:
  405.  
  406.           ./configure --host=sparc-sun-sunos4.1
  407.  
  408.      A configuration name may be canonical or it may be more or less
  409.      abbreviated.
  410.  
  411.      A canonical configuration name has three parts, separated by
  412.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  413.      parts may themselves contain dashes; `configure' can figure out
  414.      which dashes serve which purpose.)  For example,
  415.      `m68k-sun-sunos4.1' specifies a Sun 3.
  416.  
  417.      You can also replace parts of the configuration by nicknames or
  418.      aliases.  For example, `sun3' stands for `m68k-sun', so
  419.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  420.      use simply `sun3-sunos', since the version of SunOS is assumed by
  421.      default to be version 4.
  422.  
  423.      You can specify a version number after any of the system types,
  424.      and some of the CPU types.  In most cases, the version is
  425.      irrelevant, and will be ignored.  So you might as well specify the
  426.      version if you know it.
  427.  
  428.      See *Note Configurations::., for a list of supported configuration
  429.      names and notes on many of the configurations.  You should check
  430.      the notes in that section before proceeding any further with the
  431.      installation of GNU CC.
  432.  
  433.   6. When running `configure', you may also need to specify certain
  434.      additional options that describe variant hardware and software
  435.      configurations.  These are `--with-gnu-as', `--with-gnu-ld',
  436.      `--with-stabs' and `--nfp'.
  437.  
  438.     `--with-gnu-as'
  439.           If you will use GNU CC with the GNU assembler (GAS), you
  440.           should declare this by using the `--with-gnu-as' option when
  441.           you run `configure'.
  442.  
  443.           Using this option does not install GAS.  It only modifies the
  444.           output of GNU CC to work with GAS.  Building and installing
  445.           GAS is up to you.
  446.  
  447.           Conversely, if you *do not* wish to use GAS and do not specify
  448.           `--with-gnu-as' when building GNU CC, it is up to you to make
  449.           sure that GAS is not installed.  GNU CC searches for a
  450.           program named `as' in various directories; if the program it
  451.           finds is GAS, then it runs GAS.  If you are not sure where
  452.           GNU CC finds the assembler it is using, try specifying `-v'
  453.           when you run it.
  454.  
  455.           The systems where it makes a difference whether you use GAS
  456.           are
  457.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  458.           `i386-ANY-isc',
  459.           `i860-ANY-bsd', `m68k-bull-sysv',
  460.           `m68k-hp-hpux', `m68k-sony-bsd',
  461.           `m68k-altos-sysv', `m68000-hp-hpux',
  462.           `m68000-att-sysv', `ANY-lynx-lynxos', and `mips-ANY').  On
  463.           any other system, `--with-gnu-as' has no effect.
  464.  
  465.           On the systems listed above (except for the HP-PA, for ISC on
  466.           the 386, and for `mips-sgi-irix5.*'), if you use GAS, you
  467.           should also use the GNU linker (and specify `--with-gnu-ld').
  468.  
  469.     `--with-gnu-ld'
  470.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  471.           linker with GNU CC.
  472.  
  473.           This option does not cause the GNU linker to be installed; it
  474.           just modifies the behavior of GNU CC to work with the GNU
  475.           linker.
  476.  
  477.     `--with-stabs'
  478.           On MIPS based systems and on Alphas, you must specify whether
  479.           you want GNU CC to create the normal ECOFF debugging format,
  480.           or to use BSD-style stabs passed through the ECOFF symbol
  481.           table.  The normal ECOFF debug format cannot fully handle
  482.           languages other than C.  BSD stabs format can handle other
  483.           languages, but it only works with the GNU debugger GDB.
  484.  
  485.           Normally, GNU CC uses the ECOFF debugging format by default;
  486.           if you prefer BSD stabs, specify `--with-stabs' when you
  487.           configure GNU CC.
  488.  
  489.           No matter which default you choose when you configure GNU CC,
  490.           the user can use the `-gcoff' and `-gstabs+' options to
  491.           specify explicitly the debug format for a particular
  492.           compilation.
  493.  
  494.           `--with-stabs' is meaningful on the ISC system on the 386,
  495.           also, if `--with-gas' is used.  It selects use of stabs
  496.           debugging information embedded in COFF output.  This kind of
  497.           debugging information supports C++ well; ordinary COFF
  498.           debugging information does not.
  499.  
  500.           `--with-stabs' is also meaningful on 386 systems running
  501.           SVR4.  It selects use of stabs debugging information embedded
  502.           in ELF output.  The C++ compiler currently (2.6.0) does not
  503.           support the DWARF debugging information normally used on 386
  504.           SVR4 platforms; stabs provide a workable alternative.  This
  505.           requires gas and gdb, as the normal SVR4 tools can not
  506.           generate or interpret stabs.
  507.  
  508.     `--nfp'
  509.           On certain systems, you must specify whether the machine has
  510.           a floating point unit.  These systems include
  511.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  512.           `--nfp' currently has no effect, though perhaps there are
  513.           other systems where it could usefully make a difference.
  514.  
  515.     `--enable-haifa'
  516.     `--disable-haifa'
  517.           Use `--enable-haifa' to enable use of an experimental
  518.           instruction scheduler (from IBM Haifa).  This may or may not
  519.           produce better code.  Some targets on which it is known to be
  520.           a win enable it by default; use `--disable-haifa' to disable
  521.           it in these cases.  `configure' will print out whether the
  522.           Haifa scheduler is enabled when it is run.
  523.  
  524.     `--enable-threads=TYPE'
  525.           Certain systems, notably Linux-based GNU systems, can't be
  526.           relied on to supply a threads facility for the Objective C
  527.           runtime and so will default to single-threaded runtime.  They
  528.           may, however, have a library threads implementation
  529.           available, in which case threads can be enabled with this
  530.           option by supplying a suitable TYPE, probably `posix'.  The
  531.           possibilities for TYPE are `single', `posix', `win32',
  532.           `solaris', `irix' and `mach'.
  533.  
  534.     `--enable-checking'
  535.           When you specify this option, the compiler is built to
  536.           perform checking of tree node types when referencing fields
  537.           of that node.  This does not change the generated code, but
  538.           adds error checking within the compiler.  This will slow down
  539.           the compiler and may only work properly if you are building
  540.           the compiler with GNU C.
  541.  
  542.           The `configure' script searches subdirectories of the source
  543.           directory for other compilers that are to be integrated into
  544.           GNU CC.  The GNU compiler for C++, called G++ is in a
  545.           subdirectory named `cp'.  `configure' inserts rules into
  546.           `Makefile' to build all of those compilers.
  547.  
  548.           Here we spell out what files will be set up by `configure'.
  549.           Normally you need not be concerned with these files.
  550.  
  551.              * A file named `config.h' is created that contains a
  552.                `#include' of the top-level config file for the machine
  553.                you will run the compiler on (*note Config::.).  This
  554.                file is responsible for defining information about the
  555.                host machine.  It includes `tm.h'.
  556.  
  557.                The top-level config file is located in the subdirectory
  558.                `config'.  Its name is always `xm-SOMETHING.h'; usually
  559.                `xm-MACHINE.h', but there are some exceptions.
  560.  
  561.                If your system does not support symbolic links, you
  562.                might want to set up `config.h' to contain a `#include'
  563.                command which refers to the appropriate file.
  564.  
  565.              * A file named `tconfig.h' is created which includes the
  566.                top-level config file for your target machine.  This is
  567.                used for compiling certain programs to run on that
  568.                machine.
  569.  
  570.              * A file named `tm.h' is created which includes the
  571.                machine-description macro file for your target machine.
  572.                It should be in the subdirectory `config' and its name
  573.                is often `MACHINE.h'.
  574.  
  575.     `--enable-nls'
  576.     `--disable-nls'
  577.           The `--enable-nls' option enables Native Language Support
  578.           (NLS), which lets GCC output diagnostics in languages other
  579.           than American English.  No translations are available yet, so
  580.           the main users of this option now are those translating GCC's
  581.           diagnostics who want to test their work.  Once translations
  582.           become available, Native Language Support will become enabled
  583.           by default.  The `--disable-nls' option disables NLS.
  584.  
  585.     `--with-included-gettext'
  586.           If NLS is enabled, the GCC build procedure normally attempts
  587.           to use the host's `gettext' libraries, and falls back on
  588.           GCC's copy of the GNU `gettext' library only if the host
  589.           libraries do not suffice.  The `--with-included-gettext'
  590.           option causes the build procedure to prefer its copy of GNU
  591.           `gettext'.
  592.  
  593.     `--with-catgets'
  594.           If NLS is enabled, and if the host lacks `gettext' but has the
  595.           inferior `catgets' interface, the GCC build procedure normally
  596.           ignores `catgets' and instead uses GCC's copy of the GNU
  597.           `gettext' library.  The `--with-catgets' option causes the
  598.           build procedure to use the host's `catgets' in this situation.
  599.  
  600.   7. In certain cases, you should specify certain other options when
  601.      you run `configure'.
  602.  
  603.         * The standard directory for installing GNU CC is
  604.           `/usr/local/lib'.  If you want to install its files somewhere
  605.           else, specify `--prefix=DIR' when you run `configure'.  Here
  606.           DIR is a directory name to use instead of `/usr/local' for
  607.           all purposes with one exception: the directory
  608.           `/usr/local/include' is searched for header files no matter
  609.           where you install the compiler.  To override this name, use
  610.           the `--with-local-prefix' option below.  The directory you
  611.           specify need not exist, but its parent directory must exist.
  612.  
  613.         * Specify `--with-local-prefix=DIR' if you want the compiler to
  614.           search directory `DIR/include' for locally installed header
  615.           files *instead* of `/usr/local/include'.
  616.  
  617.           You should specify `--with-local-prefix' *only* if your site
  618.           has a different convention (not `/usr/local') for where to put
  619.           site-specific files.
  620.  
  621.           The default value for `--with-local-prefix' is `/usr/local'
  622.           regardless of the value of `--prefix'.  Specifying `--prefix'
  623.           has no effect on which directory GNU CC searches for local
  624.           header files.  This may seem counterintuitive, but actually
  625.           it is logical.
  626.  
  627.           The purpose of `--prefix' is to specify where to *install GNU
  628.           CC*.  The local header files in `/usr/local/include'--if you
  629.           put any in that directory--are not part of GNU CC.  They are
  630.           part of other programs--perhaps many others.  (GNU CC
  631.           installs its own header files in another directory which is
  632.           based on the `--prefix' value.)
  633.  
  634.           *Do not* specify `/usr' as the `--with-local-prefix'!  The
  635.           directory you use for `--with-local-prefix' *must not* contain
  636.           any of the system's standard header files.  If it did contain
  637.           them, certain programs would be miscompiled (including GNU
  638.           Emacs, on certain targets), because this would override and
  639.           nullify the header file corrections made by the `fixincludes'
  640.           script.
  641.  
  642.           Indications are that people who use this option use it based
  643.           on mistaken ideas of what it is for.  People use it as if it
  644.           specified where to install part of GNU CC.  Perhaps they make
  645.           this assumption because installing GNU CC creates the
  646.           directory.
  647.  
  648.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  649.      directory.
  650.  
  651.      `LANGUAGES=c' specifies that only the C compiler should be
  652.      compiled.  The makefile normally builds compilers for all the
  653.      supported languages; currently, C, C++ and Objective C.  However,
  654.      C is the only language that is sure to work when you build with
  655.      other non-GNU C compilers.  In addition, building anything but C
  656.      at this stage is a waste of time.
  657.  
  658.      In general, you can specify the languages to build by typing the
  659.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  660.      the list `c', `c++', and `objective-c'.  If you have any
  661.      additional GNU compilers as subdirectories of the GNU CC source
  662.      directory, you may also specify their names in this list.
  663.  
  664.      Ignore any warnings you may see about "statement not reached" in
  665.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  666.      escape sequence" are normal in `genopinit.c' and perhaps some
  667.      other files.  Likewise, you should ignore warnings about "constant
  668.      is so large that it is unsigned" in `insn-emit.c' and
  669.      `insn-recog.c', a warning about a comparison always being zero in
  670.      `enquire.o', and warnings about shift counts exceeding type widths
  671.      in `cexp.y'.  Any other compilation errors may represent bugs in
  672.      the port to your machine or operating system, and should be
  673.      investigated and reported (*note Bugs::.).
  674.  
  675.      Some compilers fail to compile GNU CC because they have bugs or
  676.      limitations.  For example, the Microsoft compiler is said to run
  677.      out of macro space.  Some Ultrix compilers run out of expression
  678.      space; then you need to break up the statement where the problem
  679.      happens.
  680.  
  681.   9. If you are building a cross-compiler, stop here.  *Note
  682.      Cross-Compiler::.
  683.  
  684.  10. Move the first-stage object files and executables into a
  685.      subdirectory with this command:
  686.  
  687.           make stage1
  688.  
  689.      The files are moved into a subdirectory named `stage1'.  Once
  690.      installation is complete, you may wish to delete these files with
  691.      `rm -r stage1'.
  692.  
  693.  11. If you have chosen a configuration for GNU CC which requires other
  694.      GNU tools (such as GAS or the GNU linker) instead of the standard
  695.      system tools, install the required tools in the `stage1'
  696.      subdirectory under the names `as', `ld' or whatever is
  697.      appropriate.  This will enable the stage 1 compiler to find the
  698.      proper tools in the following stage.
  699.  
  700.      Alternatively, you can do subsequent compilation using a value of
  701.      the `PATH' environment variable such that the necessary GNU tools
  702.      come before the standard system tools.
  703.  
  704.  12. Recompile the compiler with itself, with this command:
  705.  
  706.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2"
  707.  
  708.      This is called making the stage 2 compiler.
  709.  
  710.      The command shown above builds compilers for all the supported
  711.      languages.  If you don't want them all, you can specify the
  712.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  713.      should contain one or more words from the list `c', `c++',
  714.      `objective-c', and `proto'.  Separate the words with spaces.
  715.      `proto' stands for the programs `protoize' and `unprotoize'; they
  716.      are not a separate language, but you use `LANGUAGES' to enable or
  717.      disable their installation.
  718.  
  719.      If you are going to build the stage 3 compiler, then you might
  720.      want to build only the C language in stage 2.
  721.  
  722.      Once you have built the stage 2 compiler, if you are short of disk
  723.      space, you can delete the subdirectory `stage1'.
  724.  
  725.      On a 68000 or 68020 system lacking floating point hardware, unless
  726.      you have selected a `tm.h' file that expects by default that there
  727.      is no such hardware, do this instead:
  728.  
  729.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2 -msoft-float"
  730.  
  731.  13. If you wish to test the compiler by compiling it with itself one
  732.      more time, install any other necessary GNU tools (such as GAS or
  733.      the GNU linker) in the `stage2' subdirectory as you did in the
  734.      `stage1' subdirectory, then do this:
  735.  
  736.           make stage2
  737.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
  738.  
  739.      This is called making the stage 3 compiler.  Aside from the `-B'
  740.      option, the compiler options should be the same as when you made
  741.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  742.      same.  The command shown above builds compilers for all the
  743.      supported languages; if you don't want them all, you can specify
  744.      the languages to build by typing the argument `LANGUAGES="LIST"',
  745.      as described above.
  746.  
  747.      If you do not have to install any additional GNU tools, you may
  748.      use the command
  749.  
  750.           make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST
  751.  
  752.      instead of making `stage1', `stage2', and performing the two
  753.      compiler builds.
  754.  
  755.  14. Compare the latest object files with the stage 2 object files--they
  756.      ought to be identical, aside from time stamps (if any).
  757.  
  758.      On some systems, meaningful comparison of object files is
  759.      impossible; they always appear "different."  This is currently
  760.      true on Solaris and some systems that use ELF object file format.
  761.      On some versions of Irix on SGI machines and DEC Unix (OSF/1) on
  762.      Alpha systems, you will not be able to compare the files without
  763.      specifying `-save-temps'; see the description of individual
  764.      systems above to see if you get comparison failures.  You may have
  765.      similar problems on other systems.
  766.  
  767.      Use this command to compare the files:
  768.  
  769.           make compare
  770.  
  771.      This will mention any object files that differ between stage 2 and
  772.      stage 3.  Any difference, no matter how innocuous, indicates that
  773.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  774.      therefore a potentially serious bug which you should investigate
  775.      and report (*note Bugs::.).
  776.  
  777.      If your system does not put time stamps in the object files, then
  778.      this is a faster way to compare them (using the Bourne shell):
  779.  
  780.           for file in *.o; do
  781.           cmp $file stage2/$file
  782.           done
  783.  
  784.      If you have built the compiler with the `-mno-mips-tfile' option on
  785.      MIPS machines, you will not be able to compare the files.
  786.  
  787.  15. Install the compiler driver, the compiler's passes and run-time
  788.      support with `make install'.  Use the same value for `CC',
  789.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  790.      that are being installed.  One reason this is necessary is that
  791.      some versions of Make have bugs and recompile files gratuitously
  792.      when you do this step.  If you use the same variable values, those
  793.      files will be recompiled properly.
  794.  
  795.      For example, if you have built the stage 2 compiler, you can use
  796.      the following command:
  797.  
  798.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  799.  
  800.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  801.      `cpp' and `libgcc.a' in the directory
  802.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  803.      compiler driver program looks for them.  Here TARGET is the
  804.      canonicalized form of target machine type specified when you ran
  805.      `configure', and VERSION is the version number of GNU CC.  This
  806.      naming scheme permits various versions and/or cross-compilers to
  807.      coexist.  It also copies the executables for compilers for other
  808.      languages (e.g., `cc1plus' for C++) to the same directory.
  809.  
  810.      This also copies the driver program `xgcc' into
  811.      `/usr/local/bin/gcc', so that it appears in typical execution
  812.      search paths.  It also copies `gcc.1' into `/usr/local/man/man1'
  813.      and info pages into `/usr/local/info'.
  814.  
  815.      On some systems, this command causes recompilation of some files.
  816.      This is usually due to bugs in `make'.  You should either ignore
  817.      this problem, or use GNU Make.
  818.  
  819.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  820.      this bug, be sure to install the executables of GNU CC that were
  821.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  822.      not stage 1.)  They use `alloca' as a built-in function and never
  823.      the one in the library.*
  824.  
  825.      (It is usually better to install GNU CC executables from stage 2
  826.      or 3, since they usually run faster than the ones compiled with
  827.      some other compiler.)
  828.  
  829.  16. If you're going to use C++, you need to install the C++ runtime
  830.      library.  This includes all I/O functionality, special class
  831.      libraries, etc.
  832.  
  833.      The standard C++ runtime library for GNU CC is called `libstdc++'.
  834.      An obsolescent library `libg++' may also be available, but it's
  835.      necessary only for older software that hasn't been converted yet;
  836.      if you don't know whether you need `libg++' then you probably don't
  837.      need it.
  838.  
  839.      Here's one way to build and install `libstdc++' for GNU CC:
  840.  
  841.         * Build and install GNU CC, so that invoking `gcc' obtains the
  842.           GNU CC that was just built.
  843.  
  844.         * Obtain a copy of a compatible `libstdc++' distribution.  For
  845.           example, the `libstdc++-2.8.0.tar.gz' distribution should be
  846.           compatible with GCC 2.8.0.  GCC distributors normally
  847.           distribute `libstdc++' as well.
  848.  
  849.         * Set the `CXX' environment variable to `gcc' while running the
  850.           `libstdc++' distribution's `configure' command.  Use the same
  851.           `configure' options that you used when you invoked GCC's
  852.           `configure' command.
  853.  
  854.         * Invoke `make' to build the C++ runtime.
  855.  
  856.         * Invoke `make install' to install the C++ runtime.
  857.  
  858.      To summarize, after building and installing GNU CC, invoke the
  859.      following shell commands in the topmost directory of the C++
  860.      library distribution.  For CONFIGURE-OPTIONS, use the same options
  861.      that you used to configure GNU CC.
  862.  
  863.           $ CXX=gcc ./configure CONFIGURE-OPTIONS
  864.           $ make
  865.           $ make install
  866.  
  867.  17. GNU CC includes a runtime library for Objective-C because it is an
  868.      integral part of the language.  You can find the files associated
  869.      with the library in the subdirectory `objc'.  The GNU Objective-C
  870.      Runtime Library requires header files for the target's C library in
  871.      order to be compiled,and also requires the header files for the
  872.      target's thread library if you want thread support.  *Note
  873.      Cross-Compilers and Header Files: Cross Headers, for discussion
  874.      about header files issues for cross-compilation.
  875.  
  876.      When you run `configure', it picks the appropriate Objective-C
  877.      thread implementation file for the target platform.  In some
  878.      situations, you may wish to choose a different back-end as some
  879.      platforms support multiple thread implementations or you may wish
  880.      to disable thread support completely.  You do this by specifying a
  881.      value for the OBJC_THREAD_FILE makefile variable on the command
  882.      line when you run make, for example:
  883.  
  884.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2" OBJC_THREAD_FILE=thr-single
  885.  
  886.      Below is a list of the currently available back-ends.
  887.  
  888.         * thr-single Disable thread support, should work for all
  889.           platforms.
  890.  
  891.         * thr-decosf1 DEC OSF/1 thread support.
  892.  
  893.         * thr-irix SGI IRIX thread support.
  894.  
  895.         * thr-mach Generic MACH thread support, known to work on
  896.           NEXTSTEP.
  897.  
  898.         * thr-os2 IBM OS/2 thread support.
  899.  
  900.         * thr-posix Generix POSIX thread support.
  901.  
  902.         * thr-pthreads PCThreads on Linux-based GNU systems.
  903.  
  904.         * thr-solaris SUN Solaris thread support.
  905.  
  906.         * thr-win32 Microsoft Win32 API thread support.
  907.  
  908. 
  909. File: gcc.info,  Node: Configuration Files,  Next: Configurations,  Up: Installation
  910.  
  911. Files Created by `configure'
  912. ============================
  913.  
  914.    Here we spell out what files will be set up by `configure'.  Normally
  915. you need not be concerned with these files.
  916.  
  917.    * A file named `config.h' is created that contains a `#include' of
  918.      the top-level config file for the machine you will run the compiler
  919.      on (*note Config::.).  This file is responsible for defining
  920.      information about the host machine.  It includes `tm.h'.
  921.  
  922.      The top-level config file is located in the subdirectory `config'.
  923.      Its name is always `xm-SOMETHING.h'; usually `xm-MACHINE.h', but
  924.      there are some exceptions.
  925.  
  926.      If your system does not support symbolic links, you might want to
  927.      set up `config.h' to contain a `#include' command which refers to
  928.      the appropriate file.
  929.  
  930.    * A file named `tconfig.h' is created which includes the top-level
  931.      config file for your target machine.  This is used for compiling
  932.      certain programs to run on that machine.
  933.  
  934.    * A file named `tm.h' is created which includes the
  935.      machine-description macro file for your target machine.  It should
  936.      be in the subdirectory `config' and its name is often `MACHINE.h'.
  937.  
  938.    * The command file `configure' also constructs the file `Makefile'
  939.      by adding some text to the template file `Makefile.in'.  The
  940.      additional text comes from files in the `config' directory, named
  941.      `t-TARGET' and `x-HOST'.  If these files do not exist, it means
  942.      nothing needs to be added for a given target or host.
  943.  
  944.